package lab02.Test03;

/**
 * Created by lenovo on 2017/10/14.
 */
public class Student {
    //属性
private String name;
private int age;
private float english;
private float math;
private  float computer;



    //行为
public Student(String n,int a,float e,float m,float c){
    this.setName(n);
    this.setAge(a);
    this.setEnglish(e);
    this.setMath(m);
    this.setComputer(c);
}
public float sum(){
    return english+math+computer;
}
public float avg(){
    return (english+math+computer)/3;//this.sum()/3;
}
public float max(){
    float max=computer>math?computer:math;
    max=max>english?max:english;
    return max;
}
public float min(){
    float min=computer<math?computer:math;
         min=min<english?min:english;
         return min;
}
public String getlnfo() {
    return "学生信息：\n" +
            "姓名:" + this.getName() + "\n" +
            "年龄：" + this.getAge() + "\n" +
            "英语成绩：" + this.getEnglish() + "\n" +
            "数学成绩" + this.getMath() + "\n" +
            "计算机成绩" +this.getComputer();
}

    //函数


    public String getName() {
        return name;
    }

    public void setName(String name) {
        this.name = name;
    }

    public int getAge() {
        return age;
    }

    public void setAge(int age) {
        this.age = age;
    }

    public float getEnglish() {
        return english;
    }

    public void setEnglish(float english) {
        this.english = english;
    }

    public float getMath() {
        return math;
    }

    public void setMath(float math) {
        this.math = math;
    }

    public float getComputer() {
        return computer;
    }

    public void setComputer(float computer) {
        this.computer = computer;
    }
}
/*public class Demo {
    public static void main(String[] args) {
        Student stu=new Student("小牛",30,70.0f,90.0f,60.0f);
        System.out.println("总分："+stu.sum());
        System.out.println("平均成绩："+stu.avg());
        System.out.println("最高分："+stu.max());
        System.out.println("最低分："+stu.min());
        System.out.println(stu.getlnfo());

    }
}*/